#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void test1()
{
	char* test_str[] = {
		"add@/devices/platform/sw_hcd_host0/usb1=ty/ttyUSB4",
		"add@/devices/platform/sw_hcd_host0/usb1=ty/ttyACM0",
		"add@/devices/platform/sw_hcd_host0/usb1/=/1-1:1.4",
		"add@/devices/platform/sw_hcd_host0/usb1/1=1:1.5/ttyUSB6",
		"add@/devices/platform/sw_hcd_host0/usb1/1-=yUSB6/tty/ttyUSB6",
	};

	char port[64] = {0};
	char prefix[64] = {0};
	int i = 0;
	char dstr[20][64];
	int b = 0;
	for(; i < sizeof(test_str) / sizeof(char *); i++)
	{
		//strncpy(port, strstr(test_str[i], "=") + strlen("="), 64);
		//printf("%s\n", strstr(test_str[i], "=") + sizeof("="));
		//
		char* ptr = strstr(test_str[i], "ttyUSB");
		if(ptr != NULL) {
			printf("%s\n", ptr);
		}
	}
#define PPP_DEVICE_ADD_EVENT "add@/devices/virtual/net/ppp"
	int index; 
	char* msg = "add@/devices/virtual/net/ppp1";
	sscanf(msg, PPP_DEVICE_ADD_EVENT"%d", &index);
	printf("index:%d\n", index);

	char* str = strdup("ppp0");
	printf("str:%s\n", str);
}

void test2()
{
	char* str = "BASE  Version:    DM_BASE_W12.45		fejiff";					
	char result[16] = {0};
	sscanf(str, "BASE  Version:%s", result);
	printf("result:%s", result);
}

int main(int argc, char** argv)
{
	test2();
	return 0;
}
